// BootOptions.cpp : implementation file
//

#include "stdafx.h"
#include "BootOptions.h"
#include "afxdialogex.h"

// CBootOptions dialog

IMPLEMENT_DYNAMIC(CBootOptions, CDialogEx)

CBootOptions::CBootOptions(CWnd* pParent /*=NULL*/)
	: CDialogEx(CBootOptions::IDD, pParent)
{

}

CBootOptions::~CBootOptions()
{
}

void CBootOptions::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT_IMAGESIZE, m_EditImageSize);
	DDX_Control(pDX, IDC_EDIT_MANFACTURER, m_EditManufacturer);
	DDX_Control(pDX, IDC_COMBO_PLATFORMID, m_ComboPlatformID);
	DDX_Control(pDX, IDC_COMBO_EMULATION, m_ComboEmulation);
}

BEGIN_MESSAGE_MAP(CBootOptions, CDialog)
	ON_EN_CHANGE(IDC_EDIT_MANFACTURER, &CBootOptions::OnChangeEditManfacturer)
	ON_EN_CHANGE(IDC_EDIT_IMAGESIZE, &CBootOptions::OnChangeEditImagesize)
	ON_CBN_SELCHANGE(IDC_COMBO_EMULATION, &CBootOptions::OnSelchangeComboEmulation)
	ON_CBN_SELCHANGE(IDC_COMBO_PLATFORMID, &CBootOptions::OnSelchangeComboPlatformid)
	ON_WM_CLOSE()
END_MESSAGE_MAP()


// CBootOptions message handlers


BOOL CBootOptions::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	m_bChanged = FALSE;
	m_ComboPlatformID.SetCurSel(nPlatform);
	m_ComboEmulation.SetCurSel(nEmulation);
	CString cIS;
	cIS.Format("%d", m_nImageSize);
	m_EditImageSize.SetWindowText(cIS); 
	m_EditManufacturer.SetWindowText(manustr);	
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void CBootOptions::OnChangeEditManfacturer()
{
	UpdateData(TRUE);
	m_bChanged = TRUE;
}

void CBootOptions::OnChangeEditImagesize()
{
	UpdateData(TRUE);
	m_bChanged = TRUE;
}

void CBootOptions::OnSelchangeComboEmulation()
{
	UpdateData(TRUE);
	m_bChanged = TRUE;
}

void CBootOptions::OnSelchangeComboPlatformid()
{
	UpdateData(TRUE);
	m_bChanged = TRUE;
}

#include "stdlib.h"
void CBootOptions::OnClose()
{
	if (m_bChanged)
	{
		CString cIS;
		m_EditImageSize.GetWindowText(cIS); 
		nPlatform = m_ComboPlatformID.GetCurSel();
		nEmulation = m_ComboEmulation.GetCurSel();
	}
	EndDialog(m_bChanged);
}